@extends('admin.layout.main')
@section('content')
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="{{asset('/adminlte/plugins/iCheck/all.css')}}">
    <style type="text/css">
        .box-amount{font-weight: bold;color:#3c8dbc;float:left;}
    </style>
    <section class="content-header">
      <h1>
        提现记录
      </h1>
      <ol class="breadcrumb">
        <li><a href="javascript:void(0)"><i class="fa fa-dashboard"></i> 用户提现</a></li>
        <li><a href="javascript:void(0)"><i class="fa fa-dashboard"></i> 提现记录</a></li>
      </ol>
    </section>
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-12 col-xs-6">
                <div class="box">
                    <div class="box-header with-border">
                        <div class="row">
                            <div class="col-sm-10">

                            </div>
                        </div> 
                    </div>
                    
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-hover" id="user-list">
                            <div class="dataTables_filter">
                                <div class="box-amount">
                                    提现总额：@if(!$datas->isEmpty()) ￥{{$datas[0]['amount']}} @endif
                                </div>
                                <form action="" method="GET">
                                    <button type="submit" class="btn btn-info btn-sm">查询:</button><input type="search" placeholder="请输入关键字" name="keywords" class="form-control input-sm" value="{{$keywords}}">
                                      <button style="height:30px;line-height:18px" type="button" class="btn btn-default" id="daterange-btn">
                                        <span>
                                          <i class="fa fa-calendar"></i>
                                        </span>
                                        <i class="fa fa-caret-down"></i>
                                      </button>
                                      <input type="hidden" name="time" value="{{$time}}">
                                </form>
                            </div>
                            <thead>
                                <tr>
                                    <td>#</td>
                                    <th>申请人</th>
                                    <th>电话</th>
                                    <th>提现金额</th>
                                    <th>申请时间</th>
                                    <th>状态</th>
                                    <th>通过时间</th>
                                    <th>原因</th>
                                </tr>
                            </thead>
                            <tbody> 
                                @foreach($datas as $key => $data)
                                    <tr id="{{$data->id}}">
                                        <td>{{$key+1}}</td>
                                        <td>{{$data->agent->realname}}</td>
                                        <td>{{$data->agent->mobile}}</td>
                                        <td>{{$data->money}}</td>
                                        <td>{{$data->created_at}}</td>
                                        <td>@if($data->status == 1) <i class="fa fa-fw fa-check bg-success"></i>已通过 @else <i class="fa fa-fw fa-close bg-danger"></i>已拒绝 @endif</td>
                                        <td>
                                            {{$data->updated_at}}
                                        </td>
                                        <td>{{$data->reason}}</td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                        {{$datas->links()}}
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- datepicker -->
    <script src="{{asset('/adminlte/plugins/datepicker/bootstrap-datepicker.js')}}"></script>
    <!-- iCheck 1.0.1 -->
    <script src="{{asset('/adminlte/plugins/iCheck/icheck.min.js')}}"></script>
    <script type="text/javascript">
        $(function () {

            $('#daterange-btn').daterangepicker(
                {
                  ranges: {
                    '今天': [moment(), moment().add(1, 'days')],
                    '昨天': [moment().subtract(1, 'days'), moment()],
                    '最近7天': [moment().subtract(6, 'days'), moment().add(1, 'days')],
                    '最近30天': [moment().subtract(29, 'days'), moment().add(1, 'days')],
                    '本月': [moment().startOf('month'), moment().endOf('month')],
                    '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                  },
                  startDate: moment().subtract(29, 'days'),
                  endDate: moment()
                },
                function (start, end) {
                  $('#daterange-btn span').html(start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD'));
                  $("input[name = time]").val(start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD'));
                }
            );
        });

    </script>
@endsection      